<template>
	<div>
		<topheader-list></topheader-list>
		<banner-list v-bind:list="bannerList"></banner-list>
	</div>
</template>

<script>
import TopheaderList from './components/Header'
import BannerList from './components/List'
import axios from 'axios'
export default {
	name: 'Banner',
	components: {
		BannerList:BannerList,
		TopheaderList:TopheaderList,

	},
	data () {
		return {
			bannerList:[],
			showthis:'',
			toStr:'',
			// topheaderList:[],
			
		}
	},
	methods: {
		// 接受weekend发送过来的 参数
        // 要返回点第二次执行函数我也不知道为什么
		// changeTitle () {
  //           eventBus.$on('acceptTitleInfo',function(){  
  //               alert(333344)
  //               eventBus.$off('acceptTitleInfo')
  //           }); 
		// },

		getBannerInfo () {
			axios.get('/api/index.json?=city' + this.city)
				.then(this.getBannerInfoSucc)
		},
		getBannerInfoSucc (res) {
			res = res.data
			// if (res.ret && res.data) {
			// 	const data = res.data
			// 	this.bannerList = data.bannerList2
			// }
			if (res.ret && res.data) {
				const data = res.data
				this.showthis = parseInt(this.$route.params.id)

				if (this.showthis == 1) {
					this.bannerList = data.bannerList1
				}
				if (this.showthis == 2) {
					this.bannerList = data.bannerList2
				}			
				if (this.showthis == 3) {
					this.bannerList = data.bannerList3
				}
				if (this.showthis == 4) {
					this.bannerList = data.bannerList4
				}
				if (this.showthis == 5) {
					this.bannerList = data.bannerList5
				}
			}
		},		
	},
	mounted () {
		this.getBannerInfo()
		// this.changeTitle()
		// this.changeTitleInfo()
	},
}
</script>

<style lang='stylus' scoped>

</style>